package org.mozhu.mboot.admin.system.group.service;

import com.google.common.collect.Sets;
import org.mozhu.mboot.core.data.BaseService;
import org.mozhu.mboot.admin.system.group.entity.Group;
import org.mozhu.mboot.admin.system.group.repository.GroupRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Set;

/**
 * 分组 - 业务层实现类
 *
 * @author mozhu
 */
@Transactional
@Service(value = "groupService")
public class GroupServiceImpl extends BaseService<Group, Long> implements GroupService {

    @Autowired
    protected UserGroupRelationService groupRelationService;

    protected GroupRepository getBaseRepository() {
        return (GroupRepository) baseRepository;
    }

    @Override
    public Set<Long> findDefaultGroupIds() {
        return Sets.newHashSet(this.getBaseRepository().findDefaultGroupIds());
    }

    @Override
    public Set<Long> findAllActivatedGroupIds() {
        return Sets.newHashSet(this.getBaseRepository().findAllActivatedGroupIds());
    }

}
